package org.finesys.common.security.authentication.gitee;

import lombok.Getter;
import org.finesys.common.security.authentication.base.OAuth2ResourceOwnerBaseAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.oauth2.core.AuthorizationGrantType;
import org.springframework.util.Assert;

import java.util.Map;
import java.util.Set;

/**
 * gitee token信息
 */
@Getter
public class OAuth2GiteeAuthenticationToken extends OAuth2ResourceOwnerBaseAuthenticationToken {
    private final String appId;
    private final String code;
    private final String scope;
    private final String state;
    private final String binding;

    public OAuth2GiteeAuthenticationToken(AuthorizationGrantType authorizationGrantType, Authentication authentication, Set<String> scopes, Map<String, Object> additionalParams, String appId, String code, String scope, String state, String binding) {
        super(authorizationGrantType, authentication, scopes, additionalParams);
        Assert.hasText(appId, "appId 不能为空");
        Assert.hasText(code, "code 不能为空");
        this.appId = appId;
        this.code = code;
        this.scope = scope;
        this.state = state;
        this.binding = binding;
    }
}
